<template>
  <a-modal :open="open" width="600px" title="检验大类设置" centered @ok="onOk" @cancel="onCancel">
    <a-form :model="formState">
      <a-form-item name="yqbh" label="仪器编号">
        <a-input v-model:value="formState.yqbh" placeholder="请输入" />
      </a-form-item>
      <a-form-item name="yqmc" label="仪器名称">
        <a-input v-model:value="formState.yqmc" placeholder="请输入" />
      </a-form-item>
      <a-form-item name="yqlx" label="仪器类型">
        <a-select v-model:value="formState.yqlx">
          <a-select-option value="BC-1000">BC-1000</a-select-option>
          <a-select-option value="BC-2000">BC-2000</a-select-option>
        </a-select>
      </a-form-item>
      <a-form-item name="sgys" label="默认开始样本">
        <a-input v-model:value="formState.sgys" placeholder="请输入" />
      </a-form-item>
      <a-form-item name="sxh" label="顺序号">
        <a-input v-model:value="formState.sxh" placeholder="请输入" />
      </a-form-item>
    </a-form>
  </a-modal>
</template>
<script setup>
import { ref } from 'vue'
import { message } from 'ant-design-vue'
import { post } from '@/utils/request'

const emit = defineEmits(['update:open', 'success'])
defineProps({
  open: {
    type: Boolean,
    default: () => false
  },
  rowData: {
    type: Object,
    default: () => ({})
  }
})

const formState = ref({})

const onOk = async () => {
  const res = await post('/common/patient/savePatientInfo', formState.value)
  if (res.code === 0) {
    message.success('保存成功')
    emit('success')
  } else {
    message.error(res.msg || '保存失败')
  }
}

const onCancel = () => {
  emit('update:open', false)
}
// watch(
//   () => props.open,
//   (val) => {
//     if (val) {
//     }
//   }
// )
</script>

<style lang="less" scoped>
.ant-form {
  :deep(.ant-form-item) {
    .ant-form-item-label {
      width: 80px;
    }
  }
}
</style>
